<?php
/**
 * Created by PhpStorm.
 * User: XD
 * Date: 2017/9/1
 * Time: 13:50
 */

class Sql
{

    //创建数据库语句 创建数据库 Test
    const CREATE_DB = "CREATE DATABASE Test";

    //删除数据库语句
    const DELETE_DB = "DROP DATABASE Test";

    //创建数据表语句
    //AUTO_INCREMENT定义列为自增的属性，一般用于主键，数值会自动加1。
    //PRIMARY KEY关键字用于定义列为主键。 您可以使用多列来定义主键，列间以逗号分隔。
    //ENGINE 设置存储引擎，CHARSET 设置编码。
    const CREATE_TABLE = "CREATE TABLE IF NOT EXISTS testtable(".
          "test_id INT UNSIGNED AUTO_INCREMENT,".
          "test_title VARCHAR(100) NOT NULL,".
          "test_author VARCHAR(40) NOT NULL,".
          "submission_date DATE ,".
          "PRIMARY KEY (test_id))ENGINE=InnoDB DEFAULT CHARSET=utf8";

    // 删除数据表
    const DELETE_TABLE = "DROP TABLE testtable";

    
    // 插入数据
    function insert_data($submission_data){
         $runoob_title = "学习 Python";
         $runoob_author = "RUNOOB.COM";
         return "INSERT INTO testtable ".
            "(test_title,test_author,submission_date) ".
            "VALUES ".
            "('".$runoob_title."','".$runoob_author."','".$submission_data."')";
    }

    function data(){

        return "REPLACE INTO api_mws_reviews (amazoncommentid,grade,title,author,authorid,commenttype,mdate,content,helpful,participant,fetchtime,asin) VALUES 
('R3FK9KLJ839AVU','4','Works well, but laser is very hard to see ...','ByM. Macala','A1I0VDISZN7P3L','','August 8, 2017','Works well, but laser is very hard to see outside in daylight. For outside use, need shade or use it at dusk/dawn ...','0','0','1504691435','B00SWYHFW2'),
('R3FK9KLJ839AVU','3','Works!','ByDavid C. Selwyn','A2V432GMX8ANO6','','July 31, 2017','Works, not intuitive to use. OK for the price.','0','0','1504691435','B00SWYHFW2'),
('R1YM6CNARNFCWC','5','No Fuss, Economical, and reliable.','ByJon-Paul Leduc','A2PKYPWM52ZPDR','','July 29, 2017','This product just works. No trouble, just reliable measurements. The interface takes a few minutes to get used to, but not overly complicated. The seemingly complicated features turn out to be quite useful in special cases. If you just want to click and get measurements, those features will not get in your way.','0','0','1504691435','B00SWYHFW2'),
('R2KA80FQS79GPG','4','Fine.','ByPMS','A3F0U0PDUKVYCU','','July 27, 2017','Confusing menus. Otherwise quite useful.','0','0','1504691435','B00SWYHFW2'),
('RC70VZSV6V16W','3','Not rcommended for outdoor use','ByM. Williams','A29NH5QRGF1SXY','','July 16, 2017','If you are planning on using the measurer outdoors, then I don\'t recommend this measurer. I have several laser measurers and this one is the worst one for outdoor use. I cannot see the laser dot when outside in the sun. If you plan to only use it indoors, than this will probably work fine.','0','0','1504691435','B00SWYHFW2'),
('RUMLTRS6M5OLS','5','For this purpose it worked like a charm','ByJ. Mark','AINKLUH7PCRWT','','June 29, 2017','Pros: Small, light, brightly-colored to help find it. Extremely quick measurements. Uses standard AAA batteries which are readily available most everywhere, although it doesn\'t seem to drain the batteries very quickly. Screen is backlit for use in dark areas or low light. Comes with a black nylon carrying case.

Cons: Can only be used as a distance-finder for golf for distances less 50 meters. But seriously though, I can\'t think of any real cons.

I bought this as a Father\'s Day gift for myself. I thought it might come in handy as I was shortly going to be moving to a new apartment. I thought it might be helpful to plan the layout of furniture in my new place before actually moving stuff only to find out it won\'t fit. For this purpose it worked like a charm.

Operations - using this is so much easier than dealing with a standard tape measure - no need to ask someone to hold the other end, no need to hook the end on a protruding edge and no need to walk out the distance you need to measure. This device claims to perform all kinds of calculations like area, volume, etc. but the reality is that is so far beyond what I need. I suppose those could be useful, but I have already lost the paper instructions that describe how to perform those functions on the keypad and honestly in the time it would take to download the instructions on the internet and perform the calculations, I could more quickly and easily do it on my phone using a simple spreadsheet app \(or just type in to the google search bar\).

Style - I like the yellow color on the main body, which makes it stand out more than if it were a standard black plastic. This helps to prevent losing it amongst all of the other small black electronics in a pile. There are only 7 black rubber buttons on the face, and the screen is brightly backlit, helping to read the display when the lighting is poor. This easily fits into the pockets of my jeans.

Build quality - the body is plastic and relatively light. Although it doesn\'t have a snazzy metal frame, it does not feel cheaply assembled and I never got the impression that it would break if dropped. It comes with a black nylon carrying case.

Summary: I wish I had bought this earlier. Admittedly, I don\'t have experience with another laser distance measurer to compare this against, but since it more than met my needs I would definitely recommend this to a friend or colleague.','0','0','1504691435','B00SWYHFW2'),
('RWTABQ225KHZX','5','Etekcity Laser distance Measurer','ByJ. Ransom','A1F7XCYZM5JQKI','','June 25, 2017','Does what it claims to do and does it accurately. Easy to learn.','0','0','1504691435','B00SWYHFW2'),
('R3D98MM7EEHJHU','5','Great way to measure','ByJohnC','AD8T7R9D5CSZI','','June 24, 2017','This is a good quality tool for measuring long distances. The instructions are a bit difficut but after a little trial and error I was able to make accurate measurements. I actually placed a tape measure against a wall and moved out to about 10\' and then compared the laser measurement to the tape. I was within an 1/8\". The type of work I do that is well within tolerance.

I doubt I will ever need another one but would not hesitate to buy again if I needed a replacement.','0','0','1504691435','B00SWYHFW2'),
('R65A1E6H47SXE','5','Great tool! Works great!','Bytimlebaron','A35RLQMT3H0LPT','Verified Purchase','July 19, 2016','This has been a huge time saver for our real estate company! Measurements are quick and accurate. Love the mult-functionality of this tool. Use Square Footage function all the time. Saves a lot of time and calculation!','0','0','1504691435','B00SWYHFW2'),
('R1KA7CMWG6VF3V','4','Accurate measurements','ByScott Johnson','AWMGLN4BEWIN','Verified Purchase','May 16, 2016','Bought this to measure distances in my house for building built-in closets and cabinets. Very accurate, and easy to use.','0','0','1504691435','B00SWYHFW2')";


//        return "REPLACE INTO api_mws_reviews (amazoncommentid,grade,title,author,authorid,commenttype,mdate,content,helpful,participant,fetchtime,asin) VALUES ('R2E362F4VY3AT',
//'5',
//'Makes measuring distances easy and precise',
//'BySNielsen',
//'A3RMX3WZUR7FP1',
//'Verified Purchase',
//'April 6, 2017',
//'Should have bought this years ago. Makes measuring distances easy and precise. Different operation modes are very useful. Works great indoors - haven;t had a need to try them outside in bright light so can;t really comment on that.',
//'0','0','1504689389','B00SWYHDI8')"
            ;

    }

    //预处理
    const  INSERT_DATA = "INSERT INTO testtable VALUES(?,?,?)";

}